41d58ba6ijEF6fedqRO5vFu7uCirZg tools/xcs/xcsdump.c
403a3edbrr8RE34gkbR40zep98SXbg tools/xentrace/Makefile
40a107afN60pFdURgBv9KwEzgRl5mQ tools/xentrace/formats
+420d52d2_znVbT4JAPIU36vQOme83g tools/xentrace/xenctx.c
4050c413PhhLNAYk3TEwP37i_iLw9Q tools/xentrace/xentrace.8
403a3edbVpV2E_wq1zeEkJ_n4Uu2eg tools/xentrace/xentrace.c
403a3edblCUrzSj0mmKhO5HOPrOrSQ tools/xentrace/xentrace_format
--- /dev/null
+/******************************************************************************
+ * tools/xentrace/xenctx.c
+ *
+ * Tool for dumping the cpu context
+ *
+ * Copyright (C) 2005 by Intel Corp
+ *
+ * Author: Arun Sharma <arun.sharma@intel.com>
+ * Date: February 2005
+ */
+
+#include <time.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <argp.h>
+#include <signal.h>
+
+#include "xc.h"
+
+#ifdef __i386__
+void
+print_ctx(full_execution_context_t *ctx1)
+{
+ execution_context_t *ctx = &ctx1->cpu_ctxt;
+
+ printf("eip: %08lx\t", ctx->eip);
+ printf("esp: %08lx\n", ctx->esp);
+
+ printf("eax: %08lx\t", ctx->eax);
+ printf("ebx: %08lx\t", ctx->ebx);
+ printf("ecx: %08lx\t", ctx->ecx);
+ printf("edx: %08lx\n", ctx->edx);
+
+ printf("esi: %08lx\t", ctx->esi);
+ printf("edi: %08lx\t", ctx->edi);
+ printf("ebp: %08lx\n", ctx->ebp);
+
+ printf(" cs: %08lx\t", ctx->cs);
+ printf(" ds: %08lx\t", ctx->ds);
+ printf(" fs: %08lx\t", ctx->fs);
+ printf(" gs: %08lx\n", ctx->gs);
+
+}
+#endif
+
+void dump_ctx(u32 domid, u32 vcpu)
+{
+ int ret;
+ xc_domaininfo_t info;
+ full_execution_context_t ctx;
+
+ int xc_handle = xc_interface_open(); /* for accessing control interface */
+
+ ret = xc_domain_getfullinfo(xc_handle, domid, vcpu, &info, &ctx);
+ if (ret != 0) {
+ perror("xc_domain_getfullinfo");
+ exit(-1);
+ }
+ print_ctx(&ctx);
+ xc_interface_close(xc_handle);
+}
+
+int main(int argc, char **argv)
+{
+ int vcpu = 0;
+
+ if (argc < 2) {
+ printf("usage: xenctx <domid> <optional vcpu>\n");
+ exit(-1);
+ }
+
+ if (argc == 3)
+ vcpu = atoi(argv[2]);
+
+ dump_ctx(atoi(argv[1]), vcpu);
+
+ return 0;
+}
struct exec_domain *ed, full_execution_context_t *c)
{
int i;
+ unsigned long vmx_domain = ed->arch.arch_vmx.flags;
+ extern void save_vmx_execution_context(execution_context_t *);
c->flags = 0;
memcpy(&c->cpu_ctxt,
&ed->arch.user_ctxt,
sizeof(ed->arch.user_ctxt));
+
+ if (vmx_domain)
+ save_vmx_execution_context(&c->cpu_ctxt);
+
if ( test_bit(EDF_DONEFPUINIT, &ed->ed_flags) )
c->flags |= ECF_I387_VALID;
if ( KERNEL_MODE(ed, &ed->arch.user_ctxt) )